﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverlightDemo
{
    public partial class SilverlightDemoPage : UserControl
    {
        public SilverlightDemoPage()
        {
            InitializeComponent();
        }

        private DragScrollViewerAdaptor _dragScrollViewerAdaptor;

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {

            _dragScrollViewerAdaptor = new DragScrollViewerAdaptor(ScrollViewerBeingWrapped);
            DragScrollFrictionSlider.Value = 0.1;
            ShowScrollbarsCheckbox.IsChecked = true;

            Storyboard s = Resources["Intro"] as Storyboard;
            s.Begin();
        }






      

        private void UpdateDragScrollFriction(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            _dragScrollViewerAdaptor.Friction = e.NewValue;
        }

        private void CheckBox_Click(object sender, RoutedEventArgs e)
        {
            if (ShowScrollbarsCheckbox.IsChecked.GetValueOrDefault())
            {
                ScrollViewerBeingWrapped.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
                ScrollViewerBeingWrapped.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            }
            else
            {
                ScrollViewerBeingWrapped.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
                ScrollViewerBeingWrapped.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
            }
        }


    }
}
